package com.duniptech.engine.core.modeling.api;

import java.util.Collection;

import com.duniptech.engine.core.simulation.api.ICoordinator;



/**
 * Interface for the definition of coupled models. 
 * 
 * @author Jos� Luis Risco Mart�n, Saurabh Mittal.
 */
public interface ICoupled extends IAtomic {
	
	/**
	 * Retrieves the component if contained in hierarchy
	 * 
	 */
	public IAtomic getComponentWithName(String name);
	
	/**
	 * Adds a component (atomic or coupled) to the coupled model.
	 * @param component The component to add.
	 */
	public void addComponent(IAtomic component);
	
	/**
	 * Removes a component (atomic or coupled) from the coupled model.
	 * @param component The component to remove
	 */
	public void removeComponent(IAtomic component);
	
	/**
	 * Returns the components (atomic or coupled) of the coupled model.
	 * @return The components.
	 */
	public Collection<IAtomic> getComponents();
	
	/**
	 * Adds the coupling 
	 * @param componentFrom
	 * @param portFrom
	 * @param componentTo
	 * @param portTo
	 */
	public void addCoupling(IAtomic componentFrom, String portFrom, IAtomic componentTo, String portTo);
	
	/**
	 * Removes the coupling 
	 * @param componentFrom
	 * @param portFrom
	 * @param componentTo
	 * @param portTo
	 */
	public void removeCoupling(IAtomic componentFrom, String portFrom, IAtomic componentTo, String portTo);
	
	/**
	 * Returns the internal connections.
	 * @return The internal connections.
	 */
	public Collection<ICoupling> getICs();
	
	/**
	 * <P>Returns the external input connections.</P>
	 * @return The connections reference.
	 */
	public Collection<ICoupling> getEICs();
	
	/**
	 * <P>Returns the external output connections.</P>
	 * @return The connections reference.
	 */
	public Collection<ICoupling> getEOCs();
	
	
	public void setCoordinator(ICoordinator coord);
	public ICoordinator getCoordinator();
	
}
